<?php
if (!isset($website) ) { header('HTTP/1.1 404 Not Found'); die; }
$errors = "";
	function querytransform($query)
	{
		$var;
		while($row = mysql_fetch_row($query))
		{
			$var[$row[0]] [ $row[1] ] = $row[2] ;
		}
		return $var;
	}



$sql = "SELECT A.uid, A.name, A.value 
		FROM `pvpgn2_bnet` AS A INNER JOIN 
		(
			SELECT * 
			FROM `pvpgn2_bnet` 
			WHERE 	`value` = 'true' 
			AND (`name` = 'auth\\\\admin' OR `name` = 'auth\\\\operator' OR `name` = 'auth\\\\operator\\\\Warcraft 3 Frozen Throne' OR `name` = 'auth\\\\admin\\\\Warcraft 3 Frozen Throne')
		) 
		AS B ON A.uid = B.uid
		WHERE 1
									
		UNION	SELECT * FROM `pvpgn2_bnet`	WHERE	name = 'auth\\\\command_groups'";//UNION	SELECT * FROM `pvpgn2_bnet`	WHERE	name = 'auth\\\\command_groups'
									
  $result = $db->query("$sql");

  $r = $db->fetch_row($result);
  $var = querytransform($result);									
?>

<div align="center">
   <table>
    <tr>
	  <th class="padLeft">Nick</th>
	  <th width ="120">Administrador</th>
	  <th width ="120">TFT Administrador</th>
	  <th width ="120">Operador</th>
	  <th width ="120">TFT Operador</th>
	   <th width ="120">CG</th>
	</tr>
   <?php
   foreach($var as $v) { 
   						$name = $v['acct\\username'];
						$admin = $v['auth\\admin'];
						$w3admin = $v['auth\\admin\\Warcraft 3 Frozen Throne'];
						$operator = $v['auth\\operator'];
						$cg = $v['auth\\command_groups'];
						$w3operator = $v['auth\\operator\\Warcraft 3 Frozen Throne'];?>
   <tr class="row">
     <td class="padLeft font12"><?=$name?></td>
	 <td class="font12"><?=$admin?></td>
	 <td class="overflow_hidden font12"><?=$w3admin?></td>
	 <td class="font12"><?=$operator?></td>
	 <td class="font12"><i><?=$w3operator?></i></td>
	 <td class="font12"><i><?=$cg?></i></td>
    </tr>
   <?php 
   }
   
   $db->free($result);
   
?>
  </table>
</div>